from AUTOBing.config.base import Base
from selenium.webdriver.common.by import By


class Page(Base):

    #搜索框
    search_loc=(By.XPATH,'//*[@id="sb_form_q"]')
    def search(self):
        self.send_keys(self.search_loc,'软件测试自动化')

    #点击放大镜
    fangda_loc=(By.XPATH,'//*[@id="search_icon"]')
    def fangda(self):
        self.click(self.fangda_loc)

    dy1_loc=(By.XPATH,'//*[@id="b_wpt_gs_grid"]/div')
    def dy1(self):
        return self.text(self.dy1_loc)

    one_loc=(By.XPATH,'//*[@id="b_content"]')
    def one(self):
        return self.text(self.one_loc)

    #下一页
    nexts_loc=(By.XPATH,'//*[@id="b_results"]/li[10]/nav/ul/li[2]/a')
    def nexts(self):
        self.click(self.nexts_loc)

    two_loc=(By.XPATH,'//*[@id="b_content"]')
    def two(self):
        return self.text(self.two_loc)

    #断言标题
    dy2_loc=(By.XPATH,'//*[@id="sb_form_c"]/div')
    def dy2(self):
        return self.text(self.dy2_loc)

    #Bing
    dy3_loc = (By.XPATH, '//*[@id="headCont"]/h1')
    def dy3(self) :
        return self.text(self.dy3_loc)